package ooday04;

import ooday04.Dog;

import javax.xml.transform.Source;

public class Test {
    public static void main(String[] args) {

        Animal[] animals = new Animal[6];
        animals[0] = new Dog("小黑", 2, "黑色");
        animals[1] = new Dog("小白", 3, "白色");
        animals[2] = new Dog("小花", 4, "花色");
        animals[3] = new Fish("彩鳞", 7, "七彩");
        animals[4] = new Fish("金鳞", 8, "金");
        animals[5] = new Chick("三黄", 1, "黄");
        for (int i = 0; i < animals.length; i++) {
            System.out.println(animals[i]);
            animals[i].drink();
            animals[i].eat();

            if (animals[i] instanceof Dog) {
                Dog dog = (Dog) animals[i];
                dog.lookHome();
            }
                if (animals[i] instanceof Fish){
                    Fish fish = (Fish) animals[i];
                }
                if (animals[i] instanceof Chick){
                    Chick chick = (Chick) animals[i];
                    chick.layEggs();
            }
                if (animals[i]instanceof Swim){
                    Swim swim = (Swim) animals[i];
                    swim.swim();
                }
        }


/*
        Master master = new Master();
        Dog dog = new Dog("小黑", 2, "黑色");
        Dog dog1 = new Dog("小白", 3, "白色");
        Dog dog2 = new Dog("小花", 4, "花色");
        Fish fish = new Fish("彩鳞", 7, "七彩");
        Fish fish1 = new Fish("金鳞", 8, "金");
        Chick chick = new Chick("三黄", 1, "黄");
        master.feed(dog);
        master.feed(dog1);
        master.feed(dog2);
        master.feed(chick);
        master.feed(fish);
        master.feed(fish1);


 */



    }

}
























